﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace Photography.Controls.GalleryView
{
    public partial class GalleryViewControl : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            HtmlLink style = new HtmlLink();
            style.Attributes["href"] = ResolveUrl("jquery.galleryview-3.0.css");
            style.Attributes["type"] = "text/css";
            style.Attributes["rel"] = "stylesheet";
            Page.Header.Controls.Add(style);

            Page.ClientScript.RegisterClientScriptInclude("JQuery", "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js");
            Page.ClientScript.RegisterClientScriptInclude("JQuery_Timers", ResolveUrl("jquery.timers-1.2.js"));
            Page.ClientScript.RegisterClientScriptInclude("JQuery_Easing", ResolveUrl("jquery.easing.1.3.js"));
            Page.ClientScript.RegisterClientScriptInclude("JQuery_GalleryView", ResolveUrl("jquery.galleryview-3.0.js"));

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "JQuerySlideshow_GalleryView_" + ClientID,
                "<script type=\"text/javascript\"> $(document).ready(function () { $('#" + ClientID + "list').galleryView({" +
                "panel_width: 650, panel_height: 420, frame_width: 50, frame_height: 50, frame_opacity: 0.2, frame_gap: 15, " +
                "transition_interval: 8000, transition_speed: 1000, overlay_opacity: 1, filmstrip_position: 'left', filmstrip_style: 'show all', " +
                "show_filmstrip_nav: false, pointer_size: 0, show_panel_nav: false, show_captions: true, show_overlays: true " +
                "}); }); </script>");
        }

        public string DataSourceID
        {
            set { rptImages.DataSourceID = value; }
        }

        public string SourceField
        {
            get
            {
                object o = ViewState["SourceField"];
                return ((o == null) ? string.Empty : (string)o);
            }
            set
            {
                ViewState["SourceField"] = value;
            }
        }

        public string TitleField
        {
            get
            {
                object o = ViewState["TitleField"];
                return ((o == null) ? string.Empty : (string)o);
            }
            set
            {
                ViewState["TitleField"] = value;
            }
        }

        public string DescriptionField
        {
            get
            {
                object o = ViewState["DescriptionField"];
                return ((o == null) ? string.Empty : (string)o);
            }
            set
            {
                ViewState["DescriptionField"] = value;
            }
        }
    }
}